
{include file="public/meta" /}
</head>

<body class="gray-bg">
    <div class="wrapper wrapper-content">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="layui-card">
                        <div class="layui-card-header layui-bg-orange">手动添加信息</div>
                    </div>
                    <!--form元素开始-->
                    <div class="m-t ibox-content layui-form">
                        <div class="layui-form-item">
                            <input type="hidden" name="id" value="{$this_data.id}" required>
                            <label class="layui-form-label">牌照</label>
                            <div class="layui-input-block">
                                <input type="text" name="car_number" value="{$this_data.car_number}" required  lay-verify="required" autocomplete="off" class="layui-input" readonly>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <input type="hidden" name="id" value="{$this_data.id}" required>
                            <label class="layui-form-label">照片</label>
                            <div class="layui-input-block">
                                <img src="{$this_data.car_thumb}" width="100%" height="100%">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">状态</label>
                            <div class="layui-input-block">
                                <select name="status" lay-verify="required">
                                    <option value="1" {equal name="1" value="$this_data.status"} selected {/equal}">待审核</option>
                                    <option value="2" {equal name="2" value="$this_data.status"} selected {/equal}>已认证</option>
                                    <option value="0" {equal name="0" value="$this_data.status"} selected {/equal}>已删除</option>
                                </select>
                            </div>
                        </div>
                        <button type="submit" class="layui-btn layui-btn-normal" lay-submit="" lay-filter="component-form-element">更新</button>
                    </div>
                    <!--form元素结束-->
                </div>
            </div>
        </div>
    </div>
    <script>
        //Demo
        layui.use('form', function(){
            var form = layui.form;
            //监听提交
            form.on('submit(component-form-element)', function (data) {
                //$('.layui-btn').addClass('layui-disabled').attr('disabled','disabled');
                var index = layer.load();
                $.ajax({
                    url:"{:url('admin/car/car_list_edit')}",
                    type:'post',
                    dataType:'json',
                    data:data.field,
                    success:function(res){
                        if (res.data == 1) {
                            layer.close(index);
                            layer.msg(res.message);
                        } else if (res.data == 0) {
                            layer.close(index);
                            layer.open({
                                title: '审核车辆失败'
                                ,content: res.message
                            });
                        } else {
                            layer.close(index);
                            layer.open({
                                title: '审核车辆失败'
                                ,content: '出现未知错误，如果问题一直出现，您可以联系管理员'
                            });
                        }
                    },error:function () {
                        layer.close(index);
                        layer.open({
                            title: '审核车辆失败'
                            ,content: '当前网络环境不安全，拒绝登录，请调整网络环境'
                        });
                    }
                })
            });
        });
    </script>
    <!-- 全局js -->
    {include file="public/footer" /}
</body>
</html>
